<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "" "">
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:w="http://www.apusic.com/jsf/widget" xmlns:layout="http://www.apusic.com/jsf/layout"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:ajax="http://www.apusic.com/jsf/ajax"
	renderKitId="AJAX">
	<w:head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<w:stylesheet src="/css/kmp4.css" type="text/css"></w:stylesheet>
		<w:script src="/javascript/k4.js" type="text/javascript" language="UTF-8"></w:script>
		<script>
		function deleteConfirm(){
			if(securityDepartmentGrid.getSelections().length == 0){
				alert("请选择一条记录！");
				return false;
			}
			return showConfirm('你确定要删除吗？');
		}
		function editConfirm(){
			if(securityDepartmentGrid.getSelections().length == 0){
				alert("请选择一条记录！");
				return false;
			}
			return true;
		}
		function showWindow(title){
			var window_rd=window.parent.window_rd;
			window_rd.setTitle(title);
			window_rd.show();
		}
		function changeSrc(url,title){
			var iframe_rd=window.parent.iframe_rd;
			iframe_rd.location.href=url;
			showWindow(title);
		}
		</script>
	</w:head>
	<w:page title="关联部门">
		<layout:panel border="false" autoHeight="true" autoWidth="true" styleClass="k4-view">
			<layout:panel id="viewtoolbar" border="false" autoHeight="true" autoWidth="true"
				styleClass="k4-view-tool">
				<w:form>
					<w:toolBar>
						<w:button label="分配所属部门"
							image="#{facesContext.externalContext.requestContextPath}/images/create.gif" id="createDept"
							immediate="true" />
						<w:separator />
						<w:button label="修改所属部门"
							image="#{facesContext.externalContext.requestContextPath}/images/edit.gif" id="editDept" onclick="return editConfirm()"/>
						<w:separator />
						<w:button label="删除所属部门"
							image="#{facesContext.externalContext.requestContextPath}/images/delete.gif" id="deleteDept"
							onclick="return deleteConfirm();" />
					</w:toolBar>
				</w:form>
			</layout:panel>
			<w:dataGrid id="securityDepartmentGrid" toolBarPosition="bottom" rows="10" paged="true"
				border="false" showRowNumber="true" autoHeight="true" jsvar="securityDepartmentGrid" var="dap"
				singleSelect="true" styleClass="k4-view-datagrid">
				<w:outputColumn header="部门名称" width="150" value="#{dap.departmentalUnit.name}"></w:outputColumn>
				<w:outputColumn header="是否兼任" width="150" value="#{dap.type}" clientFormatter="typeConvert"></w:outputColumn>
				<w:outputColumn header="职责" width="150" value="#{dap.duty}" clientFormatter="dutyConvert"></w:outputColumn>
				<w:pagingToolbar for="securityDepartmentGrid" displayInfo="true" displayMsg="显示 {0} - {1}，共 {2} 条" />
			</w:dataGrid>
		</layout:panel>
	</w:page>
	<script>
	function typeConvert(value){
		return 'BELONG'==value?'属于':'PARTTIME'==value?'兼任':'';
	}
	function dutyConvert(value){
		return 'INCHARGE'==value?'负责人':'SECRETARY'==value?'秘书':'COMMON'==value?'普通员工':'';
	}
	</script>
</f:view>